/** \file uart.h
	\brief Simple uart functionality
	\author Jesper Hansen
	\date 2006
*/
/* **********************************************************************
**
**  This program is free software; you can redistribute it and/or
**  modify it under the terms of the GNU General Public License
**  as published by the Free Software Foundation; either version 2
**  of the License, or (at your option) any later version.
**
**  This program is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**  GNU General Public License for more details.
**
**  You should have received a copy of the GNU General Public License
**  along with this program; if not, write to the Free Software Foundation, 
**  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
**
*************************************************************************/

#ifndef __UART_H__
#define __UART_H__

#define F_CPU 16000000UL

#include <inttypes.h>
#include <avr/pgmspace.h>

// requires the constant F_CPU to be set to the frequency of the CPU crystal 
#if !defined F_CPU
#error Constant F_CPU not set !
#endif


//
// UART Default Baud rate calculation 
//
#define UART_BAUD_RATE          57600                                 
#define UART_BAUD_SELECT        (F_CPU / (UART_BAUD_RATE * 16L) - 1)    


uint8_t uart_haschar( void );

void    uart_init( void );

uint8_t uart_getringsize( void );

int     uart_getchar( void );

int     uart_putchar( char data );

void uart_puts_p(PGM_P str);

#endif
